home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / security / doc / clippings / 920215-01 < prev    next >
Encoding:
Text File  |  1992-03-20  |  12.6 KB  |  309 lines

  1. Newsgroups: alt.security,comp.sys.sun.admin
  2. From: phil@eecs.nwu.edu (William LeFebvre)
  3. Subject: announcing securelib: securing network services under SunOS
  4. Message-ID: <1992Feb15.221236.1698@eecs.nwu.edu>
  5. Organization: Northwestern University
  6. Date: Sat, 15 Feb 1992 22:12:36 GMT
  7.  
  8. There has been much discussion on these groups recently about how
  9. vulnerable system daemons like ypserv, pwdauthd, and portmap are 
  10. to hostile attack from remote Internet sites.  I have devised a
  11. clever little package that creates an alternate shared library for
  12. use with system daemons which need to be protected from unwanted
  13. connections.  It is called "securelib".
  14.  
  15. It is now at patchlevel 3 and is available via anonymous FTP from
  16. the host "eecs.nwu.edu" in "pub/securelib.tar".  Remember to retrieve
  17. it with binary mode!  If you do not have direct Internet access,
  18. then you almost certainly do not need this package.
  19.  
  20. NOTICE:  I consider this software to still be in "beta test".  I
  21. would like a few hardy souls to retrieve this version and run with
  22. it installed for a week or two then report back to me about any
  23. problems they may have encountered.  Although I believe that there
  24. are no bugs in this release, any bugs that may be there have the
  25. potential to make a system totally unusable.  Proceed with caution!
  26.  
  27. This package is presented as an alternative to dredging up and 
  28. altering source for things like ypserv and pwdauthd.  NO SUN, BSD,
  29. OR AT&T SOURCE IS NEEDED to make this package work!
  30.  
  31. Here is the README:
  32.  
  33. SunOS 4.1 secure C library package
  34.  
  35. Written by William LeFebvre, EECS Department, Northwestern University.
  36. Internet address: phil@eecs.nwu.edu
  37.  
  38. Code for reading the configuration file, along with a few important
  39. patches, was provided by Sam Horrocks of UCI (sam@ics.uci.edu).
  40.  
  41. OVERVIEW:
  42.  
  43. This package contains replacement routines for these three kernel
  44. calls: accept, recvfrom, recvmsg.  These replacements are compatible
  45. with the originals, with the additional functionality that they check
  46. the Internet address of the machine initiating the connection to make
  47. sure that it is "allowed" to connect.
  48.  
  49. Once compiled, these can be used when building a new shared libc.  The
  50. resulting libc.so can then be put in a special place.  Any program
  51. that should be protected can then be started with an alternate
  52. LD_LIBRARY_PATH.
  53.  
  54. What you need:
  55.     SunOS version 4.1, 4.1.1, or 4.1.2 (or 4.1.3 if there ever is one),
  56.     installation of the "shared library" option,
  57.     root access.
  58.  
  59. SunOS 5 (Solaris 2.0) users are on your own.  I have no idea if this
  60. will work with version 5 or its successors.
  61.  
  62. You can see if your machine has the shared library option installed by
  63. looking for the directory "/usr/lib/shlib.etc".  If it is not
  64. installed, then you will need to extract it from the distribution
  65. tapes (Sun-factory installed machines will NOT have it installed).
  66.  
  67. Do you need to use this?  If you can answer all of these questions
  68. with "yes", then this package will benefit you:
  69.  
  70.     Are you connected to the Internet (even via a local or
  71.     regional network)?
  72.  
  73.     Do all of the routers/gateways between your machine and the
  74.     "rest of the world" route all packets regardless of protocol
  75.     or port number?
  76.  
  77.     Are you concerned about the fact that any user on any system
  78.     anywhere on the Internet can connect to any network daemon
  79.     that runs on your machine, including ypserv and pwdauthd?
  80.  
  81. AVAILABILITY:
  82.  
  83. The latest version of securelib is available via anonymous FTP from
  84. the host "eecs.nwu.edu".  It is stored in the file "pub/securelib.tar".
  85. Remember to use the "binary" transfer mode!
  86.  
  87. DETAILS:
  88.  
  89. Each modified system call has the same basic algorithm:
  90.  
  91. {
  92.     int retval;
  93.  
  94.     if ((retval = syscall(...)) >= 0)
  95.     {
  96.         if (_ok_address(socket, addr, *addrlen))
  97.         {
  98.             return (retval);
  99.         }
  100.         close(retval); /* this line: "accept" only */
  101.         errno = ECONNREFUSED;
  102.         return (-1);
  103.     }
  104.     return (retval);
  105. }
  106.  
  107. Connections that are established from a host that is not "okay" will
  108. be closed (if established via "accept"), then errno will be set to
  109. ECONNREFUSED and the calling application will get an error indication
  110. back from its system call.  It is assumed that the application will
  111. deal with such an error in an intelligent fashion.  All Sun daemons
  112. that we have tried seem to handle this correctly: they merely do the
  113. system call again.
  114.  
  115. The application will only see success for machines that "_ok_address"
  116. says are acceptable.  All other connections look like failures.
  117.  
  118. The function "_ok_address" reads a configuration file (normally
  119. "/etc/securelib.conf" or "/etc/security/securelib.conf") which
  120. describes what Internet addresses are acceptable.
  121.  
  122. CONFIGURATION FILE:
  123.  
  124. The configuration file (usually /etc/securelib.conf) is read by every
  125. process using securelib to find out which hosts are allowed to make
  126. connections.  Every hour, the config file is stat'ed to see if it has
  127. changed.  If it has, the file is re-read.
  128.  
  129. The first column in the file is the name of the process to which this
  130. line applies.  If this name is "all" then this line will apply to all
  131. processes using securlib on this host.  Otherwise, this name is
  132. checked against the environment variable "SL_NAME" to see if that's a
  133. match.  If it does match, then the line is taken to apply to the
  134. current process.
  135.  
  136. The mask field (the last field on each line) is a set of bits which
  137. are taken out of the source host's address before further comparison.
  138. These are bits in the address which can be ignored.
  139.  
  140. The address field (the second field on each line) is the address which
  141. the source host's address must match in order for a connection to be
  142. successful.  The source address is only compared to this address after
  143. the bits specified by the mask field have been cancelled out.
  144.  
  145. For example, the line:
  146.  
  147. all    128.199.0.0    0.0.255.255
  148.  
  149. would apply to all programs using securelib and would allow
  150. connections from hosts whose address start with 128.199.
  151.  
  152. A host is allowed to connect if *any* of the lines in the config file,
  153. which apply to that process, give it access.  There is no way to
  154. specify a "deny" line which would cause unconditional rejection of
  155. certain addresses.
  156.  
  157. STARTING A SECURELIB PROCESS:
  158.  
  159. "make install" will install both the "start" script and the securelib
  160. shared library in the destination specified in Makefile (usually
  161. "/usr/lib/secure").  To start a process using securelib, use the
  162. command:
  163.  
  164.     /usr/lib/secure/start <program> <arguments>
  165.  
  166. This will pass the correct "SL_NAME" environment variable to the program and
  167. will set the correct LD_LIBRARY_PATH so that the program uses securelib.
  168.  
  169. SPECIAL NOTE TO SunOS 4.1.2 USERS:
  170.  
  171. There is essentially a bug in /usr/etc/shlib.etc/Makefile.  The line
  172. immediately following "libc.so:" looks like this:
  173.  
  174.         ld -assert pure-text `${OBJSORT} lorder-sparc tmp`
  175.  
  176. It should look like this:
  177.  
  178.         ld -assert pure-text `${OBJSORT} lorder-sparc tmp` -ldl
  179.  
  180. Although I have not actually tested securelib on a 4.1.2 system, I am
  181. fairly certain that you will need to make this change before securelib
  182. will compile and link successfully under 4.1.2.
  183.  
  184. INSTALLATION:
  185.  
  186. Create a file called "securelib.conf" in the source directory, using the
  187. file "securelib.conf.ex" as an example.  Be sure to tailor this file
  188. to your site's needs.  You should also make sure that you include a
  189. rule for the loopback network:
  190.  
  191. all             127.0.0.0       0.255.255.255
  192.  
  193. Edit the Makefile and make changes as appropriate to the definitions
  194. of SHLIB, DESTDIR, and CONFFILE.  SHLIB defines the location of Sun's
  195. shlib.etc directory as extracted from the installation tape.  This
  196. will almost certainly be "/usr/lib/shlib.etc".  DESTDIR is the
  197. directory in which you want the secure library (libc.so.X.X.X) and the
  198. "start" shell script installed.  CONFFILE is the full name of the
  199. installed configuration file.  The Makefile will set compile-time
  200. constants indicating the location of the configuration file, and it
  201. will also install "securelib.conf" from the current directory as the
  202. name specified by CONFFILE in the "make install" step.
  203.  
  204. The process of buliding the new shared library uses the Makefile in
  205. /usr/lib/shlib.etc.  Unfortunately, this Makefile assumes that "."
  206. is on your path.  Make sure that this is the case or the make will
  207. fail with a message like "objsort: not found".
  208.  
  209. Once you have made these changes, type "make install" and everything
  210. should go smoothly.  Typing just "make" will build the new library in
  211. the SHLIB directory, but it will not install it.
  212.  
  213. CHOOSING APPROPRIATE LOCATIONS:
  214.  
  215. Two good places for securelib.conf are "/etc" and "/etc/security".
  216. The advantage of placing it in "/etc/security" is that non-root users
  217. will not be able to determine which Internet addresses are accepted by
  218. the sensitive daemons.  This is an extra measure of security, similar
  219. to protecting /.rhosts.  However, the disadvantage is that use of the
  220. secure shared library is then restricted to only root processes (since
  221. only root can read the configuration file).  If you need non-root
  222. processes to use securelib, or if you do not feel a need to protect
  223. the information in the configuration file, then place the file in "/etc".
  224.  
  225. The location of the library itself is typically "/usr/lib/secure".
  226. There is no reasonable place to put the library in the Sun file system
  227. heirarchy, so I just invented a new directory.  REPLACING OR
  228. SUPERCEDING THE EXISTING libc LIBRARY IS NOT RECOMMENDED!!!  The
  229. intent of this package is to provide an alternate libc that can be
  230. used only on selected server processes (usually servers that are
  231. started at boot time).  The alternate library is selected by setting
  232. LD_LIBRARY_PATH before starting the server.
  233.  
  234. USING THE ALTERNATE LIBRARY:
  235.  
  236. Now decide which servers you want to protect.  I personally have
  237. chosen portmap, rpc.pwdauthd, ypserv, and rpc.yppasswdd.  Another
  238. possibility is nfsd, but remember that each packet received by nfsd
  239. must be verified by "_ok_address".  This may have a noticeable impact
  240. on nfs performance.
  241.  
  242. Modify /etc/rc.local so that it starts the daemon with the "start"
  243. script.  What I have done locally is put some code at the very
  244. beginning of rc.local to determine if the secure library is available
  245. on the system and set an environment variable accordingly:
  246.  
  247.     SECURE=""
  248.     if [ -x /usr/lib/secure/start ]; then
  249.             SECURE="/usr/lib/secure/start"
  250.     fi
  251.  
  252. Now any daemon which I want to protect is started with a line like
  253. this:
  254.  
  255.         $SECURE portmap;                echo 'starting rpc port mapper.'
  256.  
  257. If the shell script does not exist on the machine being booted, then
  258. SECURE will be null and "$SECURE portmap" will expand to merely "portmap".
  259.  
  260. NOTE TO CUSTOM SHARED LIBRARY BUILDERS:
  261.  
  262. If you have already built a customized shared library, for example if
  263. you have built a shared library with alternate gethost* routines for
  264. name resolution, you can still use this package.  Just make sure that
  265. before you type "make", the object files for your alternate library
  266. are already in place in SHLIB/tmp.  If the "tmp" subdirectory already
  267. exists, then this package will not recreate it or re-extract
  268. libc_pic.a.  However, it WILL overwrite tmp/accept.o, tmp/recvfrom.o,
  269. and tmp/recvmsg.o.  And it will add a line to lorder-sparc (after
  270. saving the original in lorder-sparc.orig).
  271.  
  272.  
  273. DISCLAIMERS:
  274.  
  275. IMPORTANT NOTE:  THIS LIBRARY DOES NOT GUARANTEE THAT YOUR MACHINE IS
  276. SECURE!!!  This library enhances security---it does not guarantee it.
  277. It can be used to plug several known security holes on machines running
  278. SunOS 4.1 and 4.1.x.
  279.  
  280. NO WARRANTY:
  281.  
  282. BECAUSE "securelib" IS DISTRIBUTED FREE OF CHARGE, THERE IS ABSOLUTELY
  283. NO WARRANTY PROVIDED, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.
  284. EXCEPT WHEN OTHERWISE STATED IN WRITING, NORTHWESTERN UNIVERSITY,
  285. WILLIAM N. LeFEBVRE AND/OR OTHER PARTIES PROVIDE "securelib" "AS IS"
  286. WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
  287. BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  288. FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY
  289. AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE "securelib"
  290. PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
  291. SERVICING, REPAIR OR CORRECTION.
  292.  
  293. IN NO EVENT WILL NORTHWESTERN UNIVERSITY, WILLIAM N. LeFEBVRE, AND/OR
  294. ANY OTHER PARTY WHO MAY MODIFY AND REDISTRIBUTE "securelib", BE LIABLE
  295. TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER
  296. SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
  297. INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
  298. BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A
  299. FAILURE OF THE PROGRAM TO OPERATE WITH OTHER PROGRAMS) THE PROGRAM,
  300. EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR
  301. FOR ANY CLAIM BY ANY OTHER PARTY.
  302.  
  303.         William LeFebvre
  304.         Computing Facilities Manager and Analyst
  305.         Department of Electrical Engineering and Computer Science
  306.         Northwestern University
  307.         <phil@eecs.nwu.edu>
  308.  
  309.